package com.tzbank.wisdom.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tzbank.wisdom.service.TellerService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(tags={"视频teller接口控制器"})
@RequestMapping(value = "/teller")
@RestController
public class TellerController {
	
	@Autowired
    private TellerService tellerService;
	
	/**	 
	 * 根据teller传递的数据来获取流程
	 * @param map
	 * @return
	 */
	@ApiOperation(value="getFlow4TellerTrade", notes="根据teller传递的数据来获取流程")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "serialNum", value = "会话ID，视频中心客户和柜员会话的唯一标识",paramType = "query",required = true),
			@ApiImplicitParam(name = "tradeNo", value = "流水号，Teller交易的唯一标识",paramType = "query",required = true) ,
			@ApiImplicitParam(name = "businessType", value = "业务类型，01是转账 02是个人信息变更",paramType = "query",required = true)
		})
	@PostMapping(value = "/getFlow4TellerTrade")
    public Map<String,Object> getFlow4tellerTrade(@RequestBody Map<String,String> reqBody) {
		return tellerService.getTellerTrade(reqBody);
    }
	
	/**	 
	 * 交易结果反馈给teller
	 * @param map
	 * @return
	 */
	@ApiOperation(value="sendTellerResult", notes="交易结果反馈给teller")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "serialNum", value = "会话ID，视频中心客户和柜员会话的唯一标识",paramType = "query",required = true),
			@ApiImplicitParam(name = "tradeNo", value = "流水号，Teller交易的唯一标识",paramType = "query",required = true)
		})
	@PostMapping(value = "/sendTellerResult")
    public String sendTellerResult(@RequestBody Map<String,String> reqBody) {
		return tellerService.sendTellerResult(reqBody);
    }
	
}
